package com.cssl.controller;

import com.cssl.vo.UsersVo;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Date;
import java.util.List;

@Controller
public class TempController {

    @GetMapping("/temp")
    public String temp(Model model, HttpSession session){
        model.addAttribute("msg","<a href='http://www.baidu.com'>百度</a>");
        model.addAttribute("list", List.of(
                new UsersVo(1,"张三","123"),
                new UsersVo(2,"李四","123"),
                new UsersVo(3,"王五","123"),
                new UsersVo(4,"老六","123")));

        UsersVo u = new UsersVo(4,"老六","123");
        model.addAttribute("user",u);
        session.setAttribute("userVo",u);

        model.addAttribute("now",new Date());
        model.addAttribute("nums",12.3456);
        model.addAttribute("url","admin");
        model.addAttribute("pageIndex",1);
        model.addAttribute("pageSize",5);

        return "temp";
    }

}
